home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
prog_c
/
cuj0696.zip
/
DWYER.ZIP
/
SPECTRAL.TST
/
CKXMOD.CX
< prev
next >
Wrap
Text File
|
1996-03-09
|
1KB
|
58 lines
/* ============ */
/* ckxmod.cx */
/* ============ */
#include <xtendefs.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <xmod.cx>
/* ==================================================================== */
/* */
/* ==================================================================== */
#define FLUSH_LINE(u) \
{ \
int x; \
do \
{ \
x = getc(u); \
} \
while (x != EOF && x != '\n'); \
}
/* ==================================================== */
/* GetStr - prompts operator with s to get string Str */
/* ==================================================== */
void
GetStr(char *s, char *Str)
{
fprintf(stderr, "%s", s);
scanf("%s", Str);
FLUSH_LINE(stdin);
}
void
main()
{
char u[128], v[128];
USHORT m[NE], n[NE];
puts("Testing Mod Function: Needs two integers per call\n");
while (main)
{
GetStr("Enter first of the next pair: ", u);
GetStr("Enter the second: ", v);
ASCTOX(u, m);
ASCTOX(v, n);
XPRINTF("Numer = ", m, 20);
XPRINTF("Denom = ", n, 20);
Xmod(m, n, m);
# if 0
printf("GCD = %.Lf\n", GetGCD(u,v));
# endif
XPRINTF("Numer % Denom = ", m, 10);
}
}